package pt.mauromad.guias.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import pt.mauromad.guias.controller.admin.AdminAccountController;

@Controller
public class AccountController extends AdminAccountController {
	@RequestMapping(value = "/account", method = RequestMethod.GET)
	public String show(Model model) {
		return super.show(model, getDomain());
	}

	@PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_ACCOUNT_MANAGER')")
	@RequestMapping(value = "/account", method = RequestMethod.POST)
	public String manage(Model model) {
		return super.manage(model, getDomain());
	}

	@RequestMapping(value = "/account/all-users")
	public String allUsers(Model model) {
		return super.allUsers(model, getAccount());
	}

	@RequestMapping(value = "/account/all-companies")
	public String allCompanies(Model model) {
		return super.allCompanies(model, getAccount());
	}
}
